<!-- 经典布局 -->
<template>
  <el-container class="layout">
    <el-header>
      <div class="header-lf">
        <div class="logo flx-center">
          <img src="@/assets/images/logo.svg" alt="logo" />
          <span>Campus Admin</span>
        </div>
        <breadcrumb v-if="layoutConfig.showBreadcrumb" />
      </div>
      <ToolBarRight />
    </el-header>

    <!-- <div class="fix-header-position"></div> -->
    <el-container id="classic-content">
      <el-aside>
        <div
          class="menu"
          :style="{ width: layoutConfig.collapseSideMenu ? '65px' : '210px' }"
        >
          <el-scrollbar>
            <el-menu
              :default-active="activeMenu"
              :router="false"
              :collapse="layoutConfig.collapseSideMenu"
              :collapse-transition="false"
              :unique-opened="true"
            >
              <SubMenu :menuList="menuList" />
            </el-menu>
          </el-scrollbar>
          <ExpandCollapseIcon class="collapse" @click="toggleSideMenu" />
        </div>
      </el-aside>
      <!-- <div
        class="fix-aside-position"
        :style="{ width: layoutConfig.collapseSideMenu ? '65px' : '210px' }"
      ></div> -->
      <el-main class="classic-main">
        <Main />
      </el-main>
    </el-container>
  </el-container>
</template>

<script setup lang="ts" name="layoutClassic">
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import Main from '@/components/layouts/main-container.vue'
import ExpandCollapseIcon from '@/components/layouts/icons-button/expand-collapse.vue'
import SubMenu from '@/components/layouts/menu/SubMenu.vue'
import ToolBarRight from '@/components/layouts/top-Navbar/top-Navbar-right/index.vue'
import { useAppConfigUserStore, useAuthMenuAndButtonStore } from '@/stores'
const appConfigUser = useAppConfigUserStore()
const authStore = useAuthMenuAndButtonStore()
const route = useRoute()
const activeMenu = computed(() => route.path)
const menuList = authStore.showMenuListGet
const { layoutConfig } = storeToRefs(appConfigUser)

function toggleSideMenu() {
  appConfigUser.toggleSideMenu()
}
</script>

<style scoped lang="scss">
#classic-content {
  height: calc(100% - 45px); // 减去头部高度
  .classic-main {
    padding: 0;
  }
}
.el-menu,
.el-menu--popup {
  :deep(.el-menu-item) {
    &.is-active {
      background: var(--el-color-primary-light-9);
      &::before {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 4px;
        content: '';
        background: var(--el-color-primary);
      }
    }
  }
}
.el-container {
  width: 100%;
  height: 100%;
  .el-header {
    // position: fixed;
    // box-sizing: border-box;
    // z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 45px;
    width: 100%;
    padding: 0 15px 0 0;
    background-color: var(--el-bg-color);
    border-bottom: 1px solid var(--el-border-color);

    .header-lf {
      display: flex;
      align-items: center;
      .logo {
        width: 210px;
        margin-right: 16px;
        span {
          font-size: 21.5px;
          font-weight: bold;
          color: var(--el-text-color-primary);
          white-space: nowrap;
        }
        img {
          width: 28px;
          object-fit: contain;
          margin-right: 6px;
        }
      }
    }
  }
  .fix-header-position {
    height: 45px;
    width: 100%;
    flex-shrink: 0;
  }

  .fix-aside-position {
    height: calc(100vh - 45px);
    flex-shrink: 0;
  }
  .el-aside {
    // position: fixed;
    // height: calc(100vh - 45px);
    // top: 45px;
    // z-index: 100;
    width: auto;
    background-color: var(--el-bg-color);
    border-right: 1px solid var(--el-border-color);
    transition: all 0.3s ease;
    .menu {
      position: relative;
      display: flex;
      flex-direction: column;
      height: 100%;
      transition: all 0.3s ease;
      .el-menu {
        overflow-x: hidden;
        border-right: none;
      }
      .collapse {
        position: absolute;
        bottom: 15px;
        right: 15px;
      }
    }
  }
}
</style>

<style lang="scss">
// guide
#driver-highlighted-element-stage {
  background-color: #606266 !important;
}
</style>
